﻿using CCTool.Scripts.Manager;
using CCTool.Scripts.ToolManagers.Managers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace CCTool.Scripts.MiniTool.MTool
{
    /// <summary>
    /// Interaction logic for String2Pinyin.xaml
    /// </summary>
    public partial class String2Pinyin : ArcGIS.Desktop.Framework.Controls.ProWindow
    {
        public String2Pinyin()
        {
            InitializeComponent();
        }


        // 十进制转换
        public void StringChange()
        {
            try
            {
                string targetstring = txt_string.Text;
                int ti = 0;
                if ((bool)ra_t1.IsChecked) { ti = 1; }
                else if ((bool)ra_t2.IsChecked) { ti = 2; }
                else if ((bool)ra_t3.IsChecked) { ti = 3; }
                else if ((bool)ra_t4.IsChecked) { ti = 4; }
                else if ((bool)ra_t5.IsChecked) { ti = 5; }

                txt_pinyin.Text = BaseTool.ChineseToPinyin(targetstring, ti);
                
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message + ee.StackTrace);
                return ;
            }

        }

        private void btn_help_Click(object sender, RoutedEventArgs e)
        {
            string url = "https://blog.csdn.net/xcc34452366/article/details/148851451";
            UITool.Link2Web(url);
        }


        private void ra_Checked(object sender, RoutedEventArgs e)
        {
            StringChange();
        }


        private void txt_string_Changed(object sender, TextChangedEventArgs e)
        {
            StringChange();
        }
    }
}
